package com.vision.exception;

import com.vision.pojo.AjaxResult;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(Exception.class)
    public AjaxResult handleException(Exception e){
        e.printStackTrace();
        return AjaxResult.error(StringUtils.hasLength(e.getMessage()) ? e.getMessage() : "系统繁忙，请稍后重试...");
    }

}
